package lily.phs.object;

import lily.phs.database.Constants;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;


public class ThreeChild implements Constants{
	
	private Context myContext;
	
	public int ttch_profileid=-1;
	private int ttch_state=-1;
	public String ttch_date="";
	public float ttch_weig_value=-1;
	public int ttch_weig_choi=-1;
	public float ttch_heig_value=-1;
	public int ttch_heig_choi=-1;
	public int ttch_sode_appr=-1;
	public float ttch_eye=-1;
	public int ttch_hearing=-1;
	public int ttch_teething=-1;
	public int ttch_cavity=-1;
	public int ttch_card=-1;
	public int ttch_abdomen=-1;
	public float ttch_sanguine=-1;
	public String ttch_other="";
	public String ttch_disease="";
	public int ttch_nenumonia=-1;
	public int ttch_diarrhea=-1;
	public int ttch_injury=-1;
	public int ttch_nenumonia_num=-1;
	public int ttch_diarrhea_num=-1;
	public int ttch_injury_num=-1;
	public String ttch_other_disease="";
	public int ttch_refe_choi=-1;
	public String ttch_refe_reasion="";
	public String ttch_refe_inst="";
	public String ttch_guide="";
	public String ttch_guide_des="";
	public String ttch_next_date="";
	public String ttch_doctor="";
	
	public ThreeChild(Context context){
		this.myContext=context;
	}
	
	public int getTtch_nenumonia_num() {
		return ttch_nenumonia_num;
	}

	public void setTtch_nenumonia_num(int ttchNenumoniaNum) {
		ttch_nenumonia_num = ttchNenumoniaNum;
	}

	public int getTtch_diarrhea_num() {
		return ttch_diarrhea_num;
	}

	public void setTtch_diarrhea_num(int ttchDiarrheaNum) {
		ttch_diarrhea_num = ttchDiarrheaNum;
	}

	public int getTtch_injury_num() {
		return ttch_injury_num;
	}

	public void setTtch_injury_num(int ttchInjuryNum) {
		ttch_injury_num = ttchInjuryNum;
	}

	public int getTtch_profileid() {
		return ttch_profileid;
	}
	
	public int getTtch_state() {
		return ttch_state;
	}
	public void setTtch_state(int ttchState) {
		ttch_state = ttchState;
	}
	public void setTtch_profileid(int ttchProfileid) {
		ttch_profileid = ttchProfileid;
	}
	public String getTtch_date() {
		return ttch_date;
	}
	public void setTtch_date(String ttchDate) {
		ttch_date = ttchDate;
	}
	public float getTtch_weig_value() {
		return ttch_weig_value;
	}
	public void setTtch_weig_value(float ttchWeigValue) {
		ttch_weig_value = ttchWeigValue;
	}
	public int getTtch_weig_choi() {
		return ttch_weig_choi;
	}
	public void setTtch_weig_choi(int ttchWeigChoi) {
		ttch_weig_choi = ttchWeigChoi;
	}
	public float getTtch_heig_value() {
		return ttch_heig_value;
	}
	public void setTtch_heig_value(float ttchHeigValue) {
		ttch_heig_value = ttchHeigValue;
	}
	public int getTtch_heig_choi() {
		return ttch_heig_choi;
	}
	public void setTtch_heig_choi(int ttchHeigChoi) {
		ttch_heig_choi = ttchHeigChoi;
	}
	public int getTtch_sode_appr() {
		return ttch_sode_appr;
	}
	public void setTtch_sode_appr(int ttchSodeAppr) {
		ttch_sode_appr = ttchSodeAppr;
	}
	public float getTtch_eye() {
		return ttch_eye;
	}
	public void setTtch_eye(float ttchEye) {
		ttch_eye = ttchEye;
	}
	public int getTtch_hearing() {
		return ttch_hearing;
	}
	public void setTtch_hearing(int ttchHearing) {
		ttch_hearing = ttchHearing;
	}
	public int getTtch_teething() {
		return ttch_teething;
	}
	public void setTtch_teething(int ttchTeething) {
		ttch_teething = ttchTeething;
	}
	public int getTtch_cavity() {
		return ttch_cavity;
	}
	public void setTtch_cavity(int ttchCavity) {
		ttch_cavity = ttchCavity;
	}
	public int getTtch_card() {
		return ttch_card;
	}
	public void setTtch_card(int ttchCard) {
		ttch_card = ttchCard;
	}
	public int getTtch_abdomen() {
		return ttch_abdomen;
	}
	public void setTtch_abdomen(int ttchAbdomen) {
		ttch_abdomen = ttchAbdomen;
	}
	public float getTtch_sanguine() {
		return ttch_sanguine;
	}
	public void setTtch_sanguine(float ttchSanguine) {
		ttch_sanguine = ttchSanguine;
	}
	public String getTtch_other() {
		return ttch_other;
	}
	public void setTtch_other(String ttchOther) {
		ttch_other = ttchOther;
	}
	public String getTtch_disease() {
		return ttch_disease;
	}
	public void setTtch_disease(String ttchDisease) {
		ttch_disease = ttchDisease;
	}
	public int getTtch_nenumonia() {
		return ttch_nenumonia;
	}
	public void setTtch_nenumonia(int ttchNenumonia) {
		ttch_nenumonia = ttchNenumonia;
	}
	public int getTtch_diarrhea() {
		return ttch_diarrhea;
	}
	public void setTtch_diarrhea(int ttchDiarrhea) {
		ttch_diarrhea = ttchDiarrhea;
	}
	public int getTtch_injury() {
		return ttch_injury;
	}
	public void setTtch_injury(int ttchInjury) {
		ttch_injury = ttchInjury;
	}
	public String getTtch_other_disease() {
		return ttch_other_disease;
	}
	public void setTtch_other_disease(String ttchOtherDisease) {
		ttch_other_disease = ttchOtherDisease;
	}
	public int getTtch_refe_choi() {
		return ttch_refe_choi;
	}
	public void setTtch_refe_choi(int ttchRefeChoi) {
		ttch_refe_choi = ttchRefeChoi;
	}
	public String getTtch_refe_reasion() {
		return ttch_refe_reasion;
	}
	public void setTtch_refe_reasion(String ttchRefeReasion) {
		ttch_refe_reasion = ttchRefeReasion;
	}
	public String getTtch_refe_inst() {
		return ttch_refe_inst;
	}
	public void setTtch_refe_inst(String ttchRefeInst) {
		ttch_refe_inst = ttchRefeInst;
	}
	public String getTtch_guide() {
		return ttch_guide;
	}
	public void setTtch_guide(String ttchGuide) {
		ttch_guide = ttchGuide;
	}
	public String getTtch_guide_des() {
		return ttch_guide_des;
	}
	public void setTtch_guide_des(String ttchGuideDes) {
		ttch_guide_des = ttchGuideDes;
	}
	public String getTtch_next_date() {
		return ttch_next_date;
	}
	public void setTtch_next_date(String ttchNextDate) {
		ttch_next_date = ttchNextDate;
	}
	public String getTtch_doctor() {
		return ttch_doctor;
	}
	public void setTtch_doctor(String ttchDoctor) {
		ttch_doctor = ttchDoctor;
	}
	
	public void insertThreeChild(){
		ContentValues value;
		value = new ContentValues();
		value.put(TTCH_PROFILEID , this.ttch_profileid);
		value.put(TTCH_STATE , this.ttch_state);
		value.put(TTCH_DATE  , this.ttch_date);
		value.put(TTCH_WEIG_VALUE , this.ttch_weig_value);
		value.put(TTCH_WEIG_CHOI , this.ttch_weig_choi);
		value.put(TTCH_HEIG_VALUE  , this.ttch_heig_value);
		value.put(TTCH_HEIG_CHOI  , this.ttch_heig_choi);
		value.put(TTCH_SODE_APPR  , this.ttch_sode_appr);
		value.put(TTCH_EYE  , this.ttch_eye);
		value.put(TTCH_HEARING  , this.ttch_hearing);
		value.put(TTCH_TEETHING  , this.ttch_teething);
		value.put(TTCH_CAVITY  , this.ttch_cavity);
		value.put(TTCH_CARD  , this.ttch_card);
		value.put(TTCH_ABDOMEN  , this.ttch_abdomen);
		value.put(TTCH_SANGUINE  , this.ttch_sanguine);
		value.put(TTCH_OTHER  , this.ttch_other);
		value.put(TTCH_DISEASE  , this.ttch_disease);
		value.put(TTCH_NEUMONIA  , this.ttch_nenumonia);
		value.put(TTCH_DIARRHEA  , this.ttch_diarrhea);
		value.put(TTCH_INJURY  , this.ttch_injury);
		value.put(TTCH_NEUMONIA_NUM  , this.ttch_nenumonia_num);
		value.put(TTCH_DIARRHEA_NUM  , this.ttch_diarrhea_num);
		value.put(TTCH_INJURY_NUM  , this.ttch_injury_num);
		value.put(TTCH_OTHER_DISEASE  , this.ttch_other_disease);
		value.put(TTCH_REFE_CHOI  , this.ttch_refe_choi);
		value.put(TTCH_REFE_REASION  , this.ttch_refe_reasion);
		value.put(TTCH_REFE_INST  , this.ttch_refe_inst);
		value.put(TTCH_GUIDE  , this.ttch_guide);
		value.put(TTCH_GUIDE_DES  , this.ttch_guide_des);
		value.put(TTCH_NEXT_DATE  , this.ttch_next_date);
		value.put(TTCH_DOCTOR , this.ttch_doctor);
		myContext.getContentResolver().insert(CONTENT_URI_TB15, value);
	}
	
	public void selectThreeChild(int pro,int state){
		Cursor cursor = myContext.getContentResolver().query(CONTENT_URI_TB15, null,
				TTCH_PROFILEID + "=" + pro + " AND "+TTCH_STATE+"="+state, null, null);
		while(cursor.moveToNext()){
			this.ttch_profileid=cursor.getInt(cursor.getColumnIndex(TTCH_PROFILEID ));
			this.ttch_state=cursor.getInt(cursor.getColumnIndex(TTCH_STATE ));
			this.ttch_date=cursor.getString(cursor.getColumnIndex(TTCH_DATE  ));
			this.ttch_weig_value=cursor.getFloat(cursor.getColumnIndex(TTCH_WEIG_VALUE  ));
			this.ttch_weig_choi=cursor.getInt(cursor.getColumnIndex(TTCH_WEIG_CHOI  ));
			this.ttch_heig_value=cursor.getFloat(cursor.getColumnIndex(TTCH_HEIG_VALUE  ));
			this.ttch_heig_choi=cursor.getInt(cursor.getColumnIndex(TTCH_HEIG_CHOI  ));
			this.ttch_sode_appr=cursor.getInt(cursor.getColumnIndex(TTCH_SODE_APPR  ));
			this.ttch_eye=cursor.getFloat(cursor.getColumnIndex(TTCH_EYE  ));
			this.ttch_hearing=cursor.getInt(cursor.getColumnIndex(TTCH_HEARING  ));
			this.ttch_teething=cursor.getInt(cursor.getColumnIndex(TTCH_TEETHING  ));
			this.ttch_cavity=cursor.getInt(cursor.getColumnIndex(TTCH_CAVITY ));
			this.ttch_card=cursor.getInt(cursor.getColumnIndex(TTCH_CARD  ));
			this.ttch_abdomen=cursor.getInt(cursor.getColumnIndex(TTCH_ABDOMEN  ));
			this.ttch_sanguine=cursor.getFloat(cursor.getColumnIndex(TTCH_SANGUINE  ));
			this.ttch_disease=cursor.getString(cursor.getColumnIndex(TTCH_DISEASE  ));
			this.ttch_other=cursor.getString(cursor.getColumnIndex(TTCH_OTHER  ));
			this.ttch_nenumonia=cursor.getInt(cursor.getColumnIndex(TTCH_NEUMONIA  ));
			this.ttch_diarrhea=cursor.getInt(cursor.getColumnIndex(TTCH_DIARRHEA  ));
			this.ttch_injury=cursor.getInt(cursor.getColumnIndex(TTCH_INJURY  ));
			this.ttch_nenumonia_num=cursor.getInt(cursor.getColumnIndex(TTCH_NEUMONIA_NUM  ));
			this.ttch_diarrhea_num=cursor.getInt(cursor.getColumnIndex(TTCH_DIARRHEA_NUM  ));
			this.ttch_injury_num=cursor.getInt(cursor.getColumnIndex(TTCH_INJURY_NUM  ));
			this.ttch_other_disease=cursor.getString(cursor.getColumnIndex(TTCH_OTHER_DISEASE  ));
			this.ttch_refe_choi=cursor.getInt(cursor.getColumnIndex(TTCH_REFE_CHOI  ));
			this.ttch_refe_reasion=cursor.getString(cursor.getColumnIndex(TTCH_REFE_REASION  ));
			this.ttch_refe_inst=cursor.getString(cursor.getColumnIndex(TTCH_REFE_INST  ));
			this.ttch_guide=cursor.getString(cursor.getColumnIndex(TTCH_GUIDE  ));
			this.ttch_guide_des=cursor.getString(cursor.getColumnIndex(TTCH_GUIDE_DES  ));
			this.ttch_next_date=cursor.getString(cursor.getColumnIndex(TTCH_NEXT_DATE  ));
			this.ttch_doctor=cursor.getString(cursor.getColumnIndex(TTCH_DOCTOR  ));
		}
		cursor.close();
	}
	
	public void updateThreeChild(int pro,int state){
		ContentValues value;
		value = new ContentValues();
		//value.put(TTCH_PROFILEID , this.ttch_profileid);
		value.put(TTCH_DATE  , this.ttch_date);
		value.put(TTCH_WEIG_VALUE , this.ttch_weig_value);
		value.put(TTCH_WEIG_CHOI , this.ttch_weig_choi);
		value.put(TTCH_HEIG_VALUE  , this.ttch_heig_value);
		value.put(TTCH_HEIG_CHOI  , this.ttch_heig_choi);
		value.put(TTCH_SODE_APPR  , this.ttch_sode_appr);
		value.put(TTCH_EYE  , this.ttch_eye);
		value.put(TTCH_HEARING  , this.ttch_hearing);
		value.put(TTCH_TEETHING  , this.ttch_teething);
		value.put(TTCH_CAVITY  , this.ttch_cavity);
		value.put(TTCH_CARD  , this.ttch_card);
		value.put(TTCH_ABDOMEN  , this.ttch_abdomen);
		value.put(TTCH_SANGUINE  , this.ttch_sanguine);
		value.put(TTCH_OTHER  , this.ttch_other);
		value.put(TTCH_DISEASE  , this.ttch_disease);
		value.put(TTCH_NEUMONIA  , this.ttch_nenumonia);
		value.put(TTCH_DIARRHEA  , this.ttch_diarrhea);
		value.put(TTCH_INJURY  , this.ttch_injury);
		value.put(TTCH_NEUMONIA_NUM  , this.ttch_nenumonia_num);
		value.put(TTCH_DIARRHEA_NUM  , this.ttch_diarrhea_num);
		value.put(TTCH_INJURY_NUM  , this.ttch_injury_num);
		value.put(TTCH_OTHER_DISEASE  , this.ttch_other_disease);
		value.put(TTCH_REFE_CHOI  , this.ttch_refe_choi);
		value.put(TTCH_REFE_REASION  , this.ttch_refe_reasion);
		value.put(TTCH_REFE_INST  , this.ttch_refe_inst);
		value.put(TTCH_GUIDE  , this.ttch_guide);
		value.put(TTCH_GUIDE_DES  , this.ttch_guide_des);
		value.put(TTCH_NEXT_DATE  , this.ttch_next_date);
		value.put(TTCH_DOCTOR , this.ttch_doctor);
		myContext.getContentResolver().update(CONTENT_URI_TB15, value, 
				TTCH_PROFILEID + "=" + pro + " AND "+TTCH_STATE+"="+state, null);
	}
	
	public void deleteThreeChild(int pro){
		myContext.getContentResolver().delete(CONTENT_URI_TB15,
				TTCH_PROFILEID + "=" + pro + "", null);
	}

}
